using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class BattleActItemSelectable : MonoBehaviour
{
	[Header("-- References --")]
	public TextMeshProUGUI Selectable_NameText;

	public Transform Selectable_InfoHolder;

	public GameObject CharacterIconPrefab;

	public Color UnselectedColor = Color.white;

	public void AddCharacterIcon(PartyMember targetPartyMember)
	{
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)CharacterIconPrefab == (Object)null)
		{
			Debug.LogWarning((object)"未找到角色贴图配置文件");
			return;
		}
		GameObject obj = Object.Instantiate<GameObject>(CharacterIconPrefab, Selectable_InfoHolder);
		obj.transform.SetAsFirstSibling();
		obj.GetComponent<Image>().sprite = targetPartyMember.PartyMemberBattleIcon;
		RectTransform rectTransform = ((Graphic)obj.GetComponent<Image>()).rectTransform;
		Rect textureRect = targetPartyMember.PartyMemberBattleIcon.textureRect;
		float num = ((Rect)(ref textureRect)).width * 2f;
		textureRect = targetPartyMember.PartyMemberBattleIcon.textureRect;
		rectTransform.sizeDelta = new Vector2(num, ((Rect)(ref textureRect)).height * 2f);
		BattlePartyMember partyMember = BattleSystem.GetPartyMember(targetPartyMember);
		if (partyMember != null && partyMember.PartyMember_Health <= 0f)
		{
			UnselectedColor = Color.gray;
			((Graphic)Selectable_NameText).color = Color.gray;
		}
	}

	public void SetSelectableName(string name)
	{
		((TMP_Text)Selectable_NameText).text = name;
	}
}
